
//--------------------------------------------
// TABLE 3: Last Term and Sudden Exit Effects
//--------------------------------------------

* HOUSE *

clear
use masterdata_house.dta

gen ln_meansalary = ln(meansalary +1)
gen nolobstaff = numstaff - futurelob
gen femaleratio = numfemale/numstaff

gen lnles = ln(les+1)
gen lntotbill = ln(totbill+1)
gen lnssbill = ln(ss_bills +1)

macro define member_char1 "majority dwnom1 budget chair subchr seniority maj_leader min_leader power"
macro define staff_char1 "ln_meansalary nolobstaff noplast plast cstaff_lob femaleratio "

* last term 

eststo clear
eststo: quietly areg lnles     $staff_char1 $member_char1 i.congress, a(icpsr) vce(cluster icpsr)
eststo: quietly areg lntotbill $staff_char1 $member_char1 i.congress, a(icpsr) vce(cluster icpsr)
eststo: quietly areg lnssbill  $staff_char1 $member_char1 i.congress, a(icpsr) vce(cluster icpsr)
esttab, star(* 0.10 ** 0.05 *** 0.01) drop(*congress*) se ar2

* sudden exit

gen sudden = 0
replace sudden = 1 if left == 1 & rexit == "DEFEATED RE-ELECTION"
replace sudden = 1 if left == 1 & rexit == "DEFEATED RE-NOMINATION"
replace sudden = 1 if left == 1 & rexit == "DIED"
replace sudden = 1 if left == 1 & rexit == "FEDERAL POST"
replace sudden = 1 if left == 1 & rexit == "SCANDAL"
replace sudden = 1 if left == 1 & rexit == "STATE LOCAL POST"
replace sudden = 1 if left == 1 & rexit == "UNSUCCESSFUL OTHER OFFICE"

gen int1 = sudden*plast

macro define staff_char2 "ln_meansalary nolobstaff noplast plast cstaff_lob femaleratio sudden int1"

eststo clear
eststo: quietly reg lnles     $staff_char2 $member_char1 i.congress, vce(cluster icpsr)
eststo: quietly reg lntotbill $staff_char2 $member_char1 i.congress, vce(cluster icpsr)
eststo: quietly reg lnssbill  $staff_char2 $member_char1 i.congress, vce(cluster icpsr)
esttab, star(* 0.10 ** 0.05 *** 0.01) drop(*congress*) se ar2

